package com.cskaoyan.service;

import com.cskaoyan.bean.bo.wx.WxFeedbackBO;
import com.cskaoyan.bean.pojo.Feedback;
import com.cskaoyan.bean.pojo.User;
import com.cskaoyan.dao.FeedbackMapper;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Array;
import java.util.Date;
import java.util.List;

/**
 * @author: hdf
 * @class: FeedbackServiceImpl 获取反馈信息
 */
@Service
public class FeedbackServiceImpl implements FeedbackService {

    @Autowired
    FeedbackMapper feedbackMapper;

    @Override
    public void feedbackSubmit(WxFeedbackBO wxFeedbackBO, User user) {
        //获取反馈数据，有选择的插入数据

        String content = wxFeedbackBO.getContent();
        String feedType = wxFeedbackBO.getFeedType();
        String mobile = wxFeedbackBO.getMobile();
        List<String> picUrls = wxFeedbackBO.getPicUrls();
        boolean hasPicture = wxFeedbackBO.isHasPicture();
        Integer id = user.getId();
        String username = user.getUsername();
        Date date = new Date();
        Integer status = Integer.valueOf(user.getStatus());
        Feedback feedback = new Feedback(null,id,username,mobile,feedType,content,status,hasPicture,picUrls.toString(),date,date,false);
        feedbackMapper.insertSelective(feedback);
    }
}
